package main.java.com.uycode.json;


import java.lang.management.GarbageCollectorMXBean;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;

public class Object2Json{

    public static void main(String[] args){

        System.out.println(System.currentTimeMillis());
        Student student = new Student();
        student.setName("ahmatjan");
        student.setAge("24");
        student.setGender("male");



        List<String> students = Arrays.asList(student.getAge(), student.getGender(), student.getName());


        Map map = (Map) JSON.toJSON(student);

        System.out.println(map);
        students.forEach(System.out::println);

        long curr_time = System.currentTimeMillis();
        System.out.println(curr_time);


    }


}
class Student{
    public String name;
    public String age;
    public String gender;

    @Override
    protected void finalize() throws Throwable {
        System.out.println("finalize");
        if (true) {
            System.out.println("Error!");
        }
        super.finalize();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }
}